var nodemailer = require("nodemailer");
 
function sendEmail (addr, title ,content) {
    var transport = nodemailer.createTransport("SMTP", {
        host: "smtp.qq.com",
        secureConnection: true,
        port: 465, 
        auth: {
            user: "1131029395@qq.com",
            pass: "ntxkwblzfkwdjagf"
        }
    });
     
    transport.sendMail({
        from : "1131029395@qq.com",
        to : addr,
        subject: title,
        generateTextFromHTML : true,
        text: content
    }, function(error, response){
        if(error){
            console.log(error);
        }else{
            console.log("Message sent: " + response.message);
        }
        transport.close();
    });
}

module.exports = sendEmail